package com.zhousb.deviceManager.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhousb.deviceManager.common.PageRequest;
import com.zhousb.deviceManager.common.R;
import com.zhousb.deviceManager.common.ResponseResult;
import com.zhousb.deviceManager.model.so.AssetSO;
import com.zhousb.deviceManager.service.AssetService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZhouShenBin
 * @date 2024/6/27 17:23
 * @description
 */
@RestController
@RequestMapping("/asset")
public class AssetController {

    @Resource
    private AssetService assetService;

    @PostMapping("/page")
    public ResponseResult page(@RequestBody PageRequest<AssetSO> so){
        return R.success(assetService.page(new Page<>(so.getCurrent(),so.getSize()),so.getQuery()));
    }

    @PostMapping("/scrap/page")
    public ResponseResult pageScrap(@RequestBody PageRequest<AssetSO> so){
        return R.success(assetService.pageScrap(new Page<>(so.getCurrent(),so.getSize()),so.getQuery()));
    }

    @PostMapping("/limit/page")
    public ResponseResult pageLimit(@RequestBody PageRequest<AssetSO> so){
        return R.success(assetService.pageLimit(new Page<>(so.getCurrent(),so.getSize()),so.getQuery()));
    }
}
